layui.define([ 'form', 'laydate', 'table'], function(exports) {
    var form = layui.form;
    var index = layui.index;
    var view = {
        init:function(){
        	  this.initSubmit();
        },
        initSubmit:function(){
        	//价格明细 
        	 $(document).on('click', '#priceDetail', function (e) {
        	 	var factoryId = $(this).val();
	           	  layer.open ({
	 					   type: 1,
	 					   title: "价格明细",
	 					   area: ['986px', '686px'],
	 					   content: $('#'+factoryId+'detailForm').html(),
	 					   success: function(index, layero){
	 						//   form.render();
	 					   },
	 					   yes: function (index, layero) {
	 						   layer.close(index);
	 					   }
	           	  });
             });
        	 
        	 //添加购物车
        	$(document).on('click','#addQuoteCart',function(){
//        		var num = new Number($("#cartNum").text());
//        		$("#cartNum").text(num+1);
        		var id = $(this).val();
        		$.post("/factoryQuoteCart/quoteCart/addQuoteCart",{"factoryId":id},function(data){
        			 Common.info("添加成功");
        			 $("#cartNum").text(data.data);
				})
        	});
        	
        	$(document).on('click',"#open-small-cart",function(){
//        		Common.openDlg('/factoryQuoteCart/quoteCart/loadQuoteCart',"购物车")
        		window.location.href = "/factoryQuoteCart/quoteCart/loadQuoteCart";
        	});
        	//去下单页面
        	$(document).on('click',"#goDown",function(){
        		var factoryId = $(this).val();
        		window.location.href = "/order/goDown/index.do?factoryId="+factoryId;
        	});
        	 
        	
        }
            
    }
    exports('index',view);
	
});